import tensorflow as tf
X = tf.reshape(tf.range(12, dtype=tf.float32), (3, 4))
Y = tf.constant([[2.0, 1, 4, 3], [1, 2, 3, 4], [4, 3, 2, 1]])
#print(tf.concat([X, Y], axis=0))
#print(tf.concat([X, Y], axis=1))
#print(X == Y)
#print(tf.reduce_sum(X))
a = tf.reshape(tf.range(3), (3, 1))
b = tf.reshape(tf.range(2), (1, 2))
X_var =tf.Variable(X)
X_var[1,2].assign(9.0)
#print(X_var)
@tf.function
def computation(X, Y):
    Z = tf.zeros_like(Y)  # 这个未使用的值将被删除
    A = X + Y  # 当不再需要时，分配将被复用
    B = A + Y
    C = B + Y
    return C + Y

#print(computation(X, Y))
a = tf.constant([3.5]).numpy()
print(a, a.item(), float(a), int(a))